public class test2 {
	public static void main(String[] a) {// |<a href='sss'>bbb</a>|<a
		// href='sss' />
		String str = "aaa|<img href='sss' />|<img href='img'>bsbab</img>|<img href='img'>bsbab</img>";
		System.out.println(str);

		String temp = str.substring(0, str.indexOf("<img")) + "[img]"
		        + str.substring(str.indexOf(">", str.indexOf("<img")) + 1);

		// System.out.println(temp);

		// String s = str.replaceAll("<\\s*img.([^/]*/\\s*>|.*<\\s*/\\s*img>)",
		// "-----[img]-----");
		String s = str.replaceAll("<\\s*img.*?(/\\s*>|.*<\\s*/\\s*img>)",
		        "-----[img]-----");

		// s = s.replaceAll("<\\s*img.*<\\s*/\\s*img>", "-----[img]-----");
		// String s = Pattern.compile("<\\s*img([^/]*/\\s*>|.*<\\s*/\\s*img>)",
		// Pattern.CASE_INSENSITIVE)
		// .matcher(str).replaceAll("$$img$$");
		System.out.println(s);
		if (s.equals(str)) System.out.println("failed!");

		exe();
		String aaa = "abcdefggwwdcww".replaceAll("a([^w][^c])*+", "-");
		System.out.println(aaa);
	}

	public static void exe() {
		for (int i = 0; i < 10000000; i++) {
			String aaa = "abcdefggwwdcww".replaceAll("a([^w][^c])*+", "-");
		}
	}
}
